#include <common.h>

#include <asm/arch/common.h>
//#include "normal_mode.h"
#include <asm/arch/sprd_reg.h>

#include "cp_boot.h"


/*add macro for memset agdsp/tddsp/ldsp share memory*/
#define DSP_BOOT_IRAM_START   0x5001F000//2k
#define LDSP_SHARE_MEM_START  0x5001F800//10k
#define TGDSP_SHARE_MEM_START 0x50022000//4k
#define MULTI_MODE_MEM_START  0x50023000//4k


/*bug:533275  memset tg/l/agdsp share memory
root cause: In agdsp share IRAM memory ,this area exits command for agdsp,when interunpt happens
from ap or cp,the agdsp will use this area. While the area exit the dirty binary data ,ap or cp
do not clean up this area when interrupt happens at the right time,so error command will cause
unexcepted problems.*/

void memset_dsp_share_memory()
{
	memset((void *)DSP_BOOT_IRAM_START,0x0,0x800);//2k
	memset((void *)LDSP_SHARE_MEM_START,0x0,0x2800);//10k
	memset((void *)TGDSP_SHARE_MEM_START,0x0,0x1000);//4k
	memset((void *)MULTI_MODE_MEM_START,0x0,0x1000);//4k
}

void modem_entry()
{
	/*workaround,change wtlcp axi to 307.2M*/
	//REG32(REG_AON_APB_SUB_SYS_DBG_SIG7) = 0x09;
	memset_dsp_share_memory();
#ifndef CONFIG_KERNEL_BOOT_CP
	pmic_arm7_boot();
	pubcp_boot();
	debugf("boot CP1 OK\n");
#else
	extern unsigned int g_charger_mode;
	if(g_charger_mode) {
		pmic_arm7_boot();
		debugf("boot arm7  OK\n");
	}
#endif
}



